import request from "@/utils/request";

const modules = {
  // 新增车辆
  addCar: (data) =>
    request({
      method: "post",
      url: "/user/car/add",
      data,
    }),
  //用户车辆列表
  getCarList: (params) =>
    request({
      method: "get",
      params,
      url: "/user/car/page",
    }),
  //更新车辆信息
  updateCarInfo: (data) =>
    request({
      method: "post",
      data,
      url: "/user/car/update",
    }),
  //删除车辆信息
  delCarInfo: (data) =>
    request({
      method: "post",
      data,
      url: "/user/car/delete",
    }),
  //新增收货地址
  addAddress: (data) =>
    request({
      method: "post",
      data,
      url: "/memberAddress/add",
    }),
  //收货地址列表
  getAddresslist: () =>
    request({
      method: "get",
      url: "/memberAddress/list",
    }),
  //收货地址详情
  getAddressDetail: (id) =>
    request({
      method: "get",
      url: `/carMall/tbReceiverInfo/${id}`,
    }),
  //编辑收货地址
  editAddress: (data) =>
    request({
      method: "put",
      data,
      url: "/carMall/tbReceiverInfo/update",
    }),
  //设置默认地址
  setDefaultAddress: (id) =>
    request({
      method: "put",
      url: `/carMall/tbReceiverInfo/setDefault/${id}`,
    }),
};

export default modules;
